package com.powernode.service.impl;

import com.powernode.mapper.BookMapper;
import com.powernode.pojo.Book;
import com.powernode.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 繁寂
 * @version 1.0
 * @since 1.0
 */
@Service
public class BookServiceImpl  implements BookService {

    @Autowired
    private BookMapper bookMapper;

    @Override
    public List<Book> selectBook(String name) {
        List<Book> bookList = bookMapper.selectByName(name);
        return bookList;
    }

    @Override
    public List<Book> selectBookAll(){
        List<Book> bookListAll = bookMapper.selectAll();
        return bookListAll;
    }

    @Override
    public int insertBook(Book book) {
        return bookMapper.insertByName(book);

    }

    @Override
    public int updateBook(Book book) {
        return bookMapper.updateByName(book);
    }

    @Override
    public int deleteBook(Book book) {
        return bookMapper.deleteByName(book);
    }
}
